//
//  BBProductCell.m
//  BearSiX
//
//  Created by Tom on 16/3/28.
//  Copyright © 2016年 Tom. All rights reserved.
//

#import "BBProductCell.h"

#define cell_height WINSIZEWIDTH/2.5
#define MainTextColor [UIColor colorWithHexString:@"363738"]
#define SecTextColor [UIColor colorWithHexString:@"3c3d3e"]

@implementation BBProductCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createUI];
    }
    return self;
}
-(void)createUI{

    /*@property(nonatomic,strong)UIImageView *statusView;;
     @property(nonatomic,strong)UILabel *productTitle;
     @property(nonatomic,strong)UIImageView *productImage;
     @property(nonatomic,strong)UILabel *productType;
     @property(nonatomic,strong)UILabel *productRMB;
     @property(nonatomic,strong)UILabel *productNum;
     @property(nonatomic,strong)UILabel *productBeginDate;
     @property(nonatomic,strong)UILabel *procuctOverDate;
     @property(nonatomic,strong)UILabel *procuctOverStatu;
     */
    
    self.statusView = [[UIImageView alloc]initWithFrame:CGRectMake(WINSIZEWIDTH/20, WINSIZEWIDTH/35, WINSIZEWIDTH/20, WINSIZEWIDTH/20)];
    //self.statusView.backgroundColor = [UIColor redColor];
    self.statusView.image = [UIImage imageNamed:@"p_choose_n"];
    self.productTitle = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.statusView.frame)+WINSIZEWIDTH/80, 0, WINSIZEWIDTH-CGRectGetMaxX(self.statusView.frame)-WINSIZEWIDTH/20, self.statusView.height+self.statusView.y*2)];
    self.productTitle.textColor = MainTextColor;
    self.productTitle.font = [UIFont systemFontOfSize:WINSIZEWIDTH/22];
    self.productTitle.text = @"【爱】满月摄影，掌中宝";
    
    UIView *backView = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(self.productTitle.frame), WINSIZEWIDTH, cell_height-CGRectGetMaxY(self.productTitle.frame))];
    backView.backgroundColor = [UIColor colorWithHexString:@"f2f4f5"];
    self.productImage = [[UIImageView alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.statusView.frame)+WINSIZEWIDTH/50, WINSIZEWIDTH/90, backView.height-WINSIZEWIDTH/45, backView.height-WINSIZEWIDTH/45)];
    self.productImage.backgroundColor = [UIColor brownColor];
    self.productImage.image = [UIImage imageNamed:@"p_choose_n"];
    self.productType = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.productImage.frame)+WINSIZEWIDTH/60, self.productImage.y, WINSIZEWIDTH/2, WINSIZEWIDTH/20)];
    self.productType.text = @"产品类型：摄影";
    self.productType.font = [UIFont systemFontOfSize:WINSIZEWIDTH/24];
    self.productType.textColor = SecTextColor;
    
    self.productBeginDate = [[UILabel alloc]initWithFrame:CGRectMake(self.productType.x, self.productType.y+self.productType.height*2, self.productType.width, self.productType.height)];
    self.productBeginDate.textColor = SecTextColor;
    self.productBeginDate.text = @"整件日期：2015-11-09";
    self.productBeginDate.font = self.productType.font;
    
    self.productOverDate = [[UILabel alloc]initWithFrame:CGRectMake(self.productType.x, CGRectGetMaxY(self.productBeginDate.frame), self.productBeginDate.width, self.productBeginDate.height)];
    self.productOverDate.text = @"取件日期：2015-11-19";
    self.productOverDate.font = self.productBeginDate.font;
    self.productOverDate.textColor = SecTextColor;
   // self.productOverDate.backgroundColor = [UIColor greenColor];
    
    self.productRMB = [[UILabel alloc]initWithFrame:CGRectMake(WINSIZEWIDTH-WINSIZEWIDTH/6, self.productType.y, WINSIZEWIDTH/6-WINSIZEWIDTH/40, self.productType.height)];
    self.productRMB.textColor = YDREDCOLOr;
    self.productRMB.font = [UIFont systemFontOfSize:WINSIZEWIDTH/23];
    self.productRMB.text = @"￥84";
    self.productRMB.textAlignment = NSTextAlignmentRight;
    
    self.productNum = [[UILabel alloc]initWithFrame:CGRectMake(self.productRMB.x, CGRectGetMaxY(self.productRMB.frame), self.productRMB.width, self.productRMB.height)];
    self.productNum.textAlignment = NSTextAlignmentRight;
    self.productNum.font = self.productRMB.font;
    self.productNum.text = @"x1";
    self.productNum.textColor = self.productType.textColor;
    
    self.productOverStatu = [[UILabel alloc]initWithFrame:CGRectMake(self.productNum.x, self.productOverDate.y, self.productNum.width, self.productBeginDate.height)];
    self.productOverStatu.textColor = self.productType.textColor;
    self.productOverStatu.text = @"2/3";
    self.productOverStatu.textAlignment = NSTextAlignmentRight;
    self.productOverStatu.font = self.productOverDate.font;
    
    
    [backView addSubview:self.productImage];
    [backView addSubview:self.productType];
    [backView addSubview:self.productBeginDate];
    [backView addSubview:self.productOverDate];
    [backView addSubview:self.productRMB];
    [backView addSubview:self.productNum];
    [backView addSubview:self.productOverStatu];
    [self addSubview:self.statusView];
    [self addSubview:self.productTitle];
    [self addSubview:backView];
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
